var hosturl = "https://bab.moreqifu.cn";
var links = {};
var requestData = {};

// 复制搜索和朋友圈模式统计数据

function linksStatistics() {
    var links_type = $("#type").val();
    if (links_type == 2) {
        links["links_id"] = $("#links_id").val();
        requestDataMethod();
    }
}

function requestDataMethod() {
    var nowtimestamp = Math.round(new Date().getTime()/1000).toString();
    var leftlength = 16 - links.links_id.length;
    if (leftlength >= 0) {
        var key = links.links_id;
        for (var i = 0; i < leftlength; i++) {
            key += "W";
        }
    } else {
        var key = links.links_id.slice(0,16);
    }
    var timestamp = parseInt(nowtimestamp) + 60;
    var iv = timestamp+"WLWLWL";
    var saltstart = "wl";
    var saltend = "lw";
    var sign = CryptoJS.MD5(saltstart+iv+key+iv+saltend).toString();
    requestData = {"key":key,"timestamp":timestamp,"sign":sign}
    usersStatistics();
}

function usersStatistics() {
    if(links.type == 1) return;
    wailianStaticMethod(hosturl+"/api/version/1/jump/links_statistic",links.links_id,requestData,true,false);  
}